/**
  * Copyright 2019 bejson.com 
  */
package com.xingkeduo.dto.transter.orderadd;

import com.xingkeduo.utils.ResponseUtils;
import lombok.Data;

@Data
public class OrderAdd {

    private int error;
    private Object reason;
    private ContentOrderAdd content;


    public void covert(ResponseUtils insert) {
        boolean bf = insert.getStatus()==1;
        this.error = bf?0:1;
        if(!bf && "用户不存在".equals(insert.getMsg())){
            this.error =9004;
        }
        this.reason = insert.getMsg();
        if(!bf ){
            if("您还有未服务的订单".equals(insert.getMsg())){
                this.error =503;
                this.reason = "您还有未服务的订单哦，请服务完成后再预约。";
            }
            if("你还有未支付订单".equals(insert.getMsg())){
                this.error =502;
                this.reason = "您还有未服务的订单哦，请服务完成后再预约。";
            }
        }

        this.content = new ContentOrderAdd(String.valueOf(bf?insert.getData():insert.getCode()));
    }
}